home *** CD-ROM | disk | FTP | other *** search
- /****i* SOURCE_FILE/INFO
- *
- * NAME
- * URLRequest.js
- *
- * USAGE
- * Part of Netobjects JavaScript Library.
- *
- * COPYRIGHT
- * Copyright ⌐ 2000-2005 Website Pros, Inc.
- * All Rights Reserved.
- *
- * This is an unpublished work protected by Website Pros, Inc.
- * as a trade secret, and is not to be used or disclosed except as
- * expressly provided in a written license agreement executed by
- * you and Website Pros, Inc.
- *
- * <copyright@websitepros.com>
- *
- * NOTES
- * JavaScript code.
- *
- *****/
- if (!IS.isModuleInitialized("IS.NOF.NET.URLRequest"))
- {
- /****h* NOF_JavaScript_Library/NOF.NET.URLRequest
- *
- * NAME
- * NOF.NET.URLRequest
- *
- * DESCRIPTION
- *
- * The <code>URLRequest</code> class
- *
- * External dependencies: NOF.Contract
- ****/
- /**
- * constructor
- * @param _serverName
- **/
- function NET_URLRequest(_serverName) {
- this.__proto__ = NET_URLRequest.prototype;
-
- if (arguments.length > 0)
- this.serverName = _serverName;
-
- this.parameters = new Array();
- }
-
- {
- var member = NET_URLRequest.prototype;
-
- member.parameters = null;
- member.serverName = null;
-
- member.getServerName = function () {
- return this.serverName;
- }
-
- member.setAttribute = function (name, value) {
- this.parameters[name] = value;
- }
-
- member.getAttribute = function (name) {
- var value = this.parameters[name];
- NOF.Contract.Assert(value, "Not find parameter with name '" + name + "' in request");
- return this.parameters[name];
- }
-
- member.getQueryString = function () {
- var query = this.serverName + "?";
- for ( var i in this.parameters ) {
- if ( typeof(this.parameters[i]) != "string" ) {
- NOF.Contract.Assert(this.parameters[i], "Not a String parameter in request");
- continue;
- }
- query += i + "=" + this.parameters[i] + "&";
- }
- NOF.Contract.Assert(query, "Empty request");
-
- return query.substring(0, query.lastIndexOf("&"));;
- }
-
- }
-
- NET.__proto__.URLRequest = NET_URLRequest;
- }